import { request } from '../utils'

// 获取知识助手内容
export function getAssistant(payload: any) {
  const formData = {
    "channel": { "sourceId": 66 },
    "inputMessage": {
      "inQues": payload
    },
    "chatVisitor": {
      "clientId": "Av4qlEIrgEBwnUR",
      "loadTimes": 1,
      "name": "test"
    },
    "sysNum": "1524918390007813",
    "uuid": "d1441404-f3f8-4477-b94b-dd64d3cac670"
  }
  return request.post(`https://kgrobot.plantdata.ai/plantdata_qa/api/faqbot/query`, { ...formData })
}

// 获取知识助手搜索下拉
export function getAutoComplete(payload: any) {
  const formData = {
    "channel": { "sourceId": 3 },
    "inputMessage": {
      "inQues": payload
    },
    "chatVisitor": {
      "clientId": "Av4qlEIrgEBwnUR",
      "loadTimes": 1,
      "name": "test"
    },
    "sysNum": "1524918390007813",
    "uuid": "d1441404-f3f8-4477-b94b-dd64d3cac670"
  }
  return request.post(`https://kgrobot.plantdata.ai/plantdata_qa/api/faqbot/prompt`, { ...formData })
}

// 获取知识助手搜索下拉
export function searchSelectedText(payload: any) {
  const { text, ...rest } = payload
  console.info('数据', text, rest)
  const formData = {
    "channel": { "sourceId": 66 },
    "inputMessage": {
      "inQues": text
    },
    ...rest,
    "chatVisitor": {
      "clientId": "Av4qlEIrgEBwnUR",
      "loadTimes": 1,
      "name": "test"
    },
    "sysNum": "1524918390007813",
    "uuid": "d1441404-f3f8-4477-b94b-dd64d3cac670"
  }
  return request.post(`/kgassist/move/search`, { ...formData })
}

// 获取文档里的关键词
export function getTextKeywords(payload: string) {
  return request.post(`/kgassist/read`, { content: payload })
}
